﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Zhuang.DAL.Access;

namespace Zhuang.WinForm.Reports.Sales
{
    public partial class PosMaster : Form
    {
        Pos_SalesOrdersMasterDAL pos_SalesOrdersMasterDAL = new Pos_SalesOrdersMasterDAL();

        public PosMaster()
        {
            InitializeComponent();
        }

        private void Pos_Load(object sender, EventArgs e)
        {
            summaryText1.Initialize(dgvMain, "Amount");
            dgvMain.AutoGenerateColumns = false;
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {

            dgvMain.DataSource= pos_SalesOrdersMasterDAL.Get(GetConditions());
            summaryText1.Calculate();
        }

        private string GetConditions()
        {
            string conditions=" CreationDate Between cdate('{0}') and cdate('{1}') ";

            conditions=string.Format(conditions,dateTimeSelect1.GetStartDate(),dateTimeSelect1.GetEndDate());
            
            return conditions;
        }
    }
}
